package com.bytedance.social.controller;

import com.bytedance.social.request.FavoriteActionRequest;
import com.bytedance.social.request.FavoriteListRequest;
import com.bytedance.social.respones.FavoriteActionResponse;
import com.bytedance.social.respones.FavoriteListResponse;
import com.bytedance.social.service.FavoriteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/douyin/favorite")
public class FavoriteController {

    @Autowired
    private FavoriteService favoriteService;

    /**
     * @param favoriteActionRequest
     * @return
     */
    @PostMapping("/action")
    public FavoriteActionResponse favoriteAction(FavoriteActionRequest favoriteActionRequest) {
        FavoriteActionResponse favoriteActionResponse = favoriteService.favoriteAction(favoriteActionRequest);
        return favoriteActionResponse;
    }

    /**
     * 获取登录用户的喜欢列表
     *
     * @return
     */
    @GetMapping("/list")
    public FavoriteListResponse getUserFavorite(FavoriteListRequest favoriteListRequest) {
        FavoriteListResponse favoriteListResponse = favoriteService.getUserFavorite(favoriteListRequest);
        return favoriteListResponse;
    }
}
